<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="../Ajs/vue.js"></script>
    <script src="../Ajs/vue.min.js"></script>
</head>
<body>

<div id="box">
    <div>{{date | format("YYYY/MM/DD")}}</div>
</div>


<script>

    Vue.filter("format",function(val,data){
        var format = data;
        var date = new Date(val);
        var weekday = ["日","一","二","三","四","五","六",];
        var config = {
            YYYY: date.getFullYear(),
            MM:(date.getMonth() + 1) < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1,
            DD: date.getDate() < 10 ? "0" + date.getDate() : date.getDate(),
            hh: date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
            mm:date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
            ss: date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(),
            W:weekday[date.getDay()]
        };

        for(var key1 in config){
            format = format.replace(key1,config[key1]);
        }
        return format;
    });
    var vm = new Vue({
        el:"#box",
        data:{
            date:"2020-09-13"
        },
        methods:{

        }
    });



</script>

</body>
</html>
